// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System.Collections.Generic;

namespace SnapObjects.Data
{
    internal class SimpleReadFormater<TModel> : IDataReadFormater<TModel>
    {
        protected readonly INodeReader _root;
        protected readonly IModelMeta _modelMeta;
        protected readonly DataFormatSetting _setting;

        public SimpleReadFormater(INodeReader root, IModelMeta modelMeta, DataFormatSetting setting)
        {
            _root = root;
            _setting = setting;
            _modelMeta = modelMeta;
        }

        public string Name => null;

        public FormatType Type => FormatType.Simple;

        public IEnumerable<IModelEntry<TModel>> GetModelEntries()
        {
            return new ModelEntryLazyParser<TModel>(_root, _modelMeta, _setting, null, RowFormat.Simple);
        }
    }
}
